﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Resto.CostControl.Core.Domain.Model;
using Resto.CostControl.Core.Cache;
using Resto.CostControl.Common.Consts;
using System.ComponentModel.DataAnnotations;

namespace Resto.CostControl.Core.Facade.SiteModule.DataTransferObject
{
    /// <summary>
    /// 项目点
    /// </summary>
    [Serializable]
    public class SiteDTO
    {
        #region 构造函数

        public SiteDTO() { }

        internal SiteDTO(Site site)
        {
            this.ID = site.ID;
            this.Code = site.Code;
            this.Name = site.Name;
            this.SiteAddress = site.SiteAddress;
            this.DeliveryAddress = site.DeliveryAddress;
            this.PMName = site.PMName;
            this.ChefsName = site.ChefsName;
            this.AreaCode = site.AreaCode;
        }

        #endregion

        #region 基本属性

        public string ID { get; set; }

        /// <summary>
        /// 项目点编号
        /// </summary>
        [Display(Name = "项目点编号")]
        public string Code { get; set; }

        /// <summary>
        /// 项目点名称
        /// </summary>
        [Display(Name = "项目点名称")]
        public string Name { get; set; }

        /// <summary>
        /// 站点地址
        /// </summary>
        [Display(Name = "站点地址")]
        public string SiteAddress { get; set; }

        /// <summary>
        /// 收货地址
        /// </summary>
       [Display(Name = "收货地址")]
        public string DeliveryAddress { get; set; }

        /// <summary>
        /// 项目经理名称
        /// </summary>
        [Display(Name = "项目经理名称")]
        public string PMName { get; set; }

        /// <summary>
        /// 厨师长名称
        /// </summary>
        [Display(Name = "厨师长名称")]
        public string ChefsName { get; set; }

        /// <summary>
        /// 所属区域代码
        /// </summary>
        [Display(Name = "所属区域代码")]
        public string AreaCode { get; set; }

        /// <summary>
        /// 所属区域的名称
        /// </summary>
        [Display(Name = "所属区域的名称")]
        public string AreaName
        {
            get
            {
                return DictionaryVOArrayCache.GetDicNameByCode(DictionaryTypeConsts.String_Area_Code, AreaCode);
            }
        }

        #endregion

        #region 方法

        internal Site ToSite()
        {
            Site site = new Site();
            CopyToSite(site);
            return site;
        }

        internal void CopyToSite(Site site)
        {
            site.Name = this.Name;
            site.Code = this.Code;
            site.SiteAddress = this.SiteAddress;
            site.DeliveryAddress = this.DeliveryAddress;
            site.PMName = this.PMName;
            site.ChefsName = this.ChefsName;
            site.AreaCode = this.AreaCode;
        }

        #endregion
    }
}
